package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/customer/orders/project")
@Api(tags = "服务项接口")
public class CustomerOrdersProjectController extends BaseController {


    @Autowired
    private NursingProjectService nursingProjectService;
    @GetMapping("/page")
    @ApiOperation("分页查询护理项目列表")
    public ResponseResult<PageResponse<NursingProjectVo>> getCancelledReservationCount(
            @ApiParam(value = "当前页") @RequestParam(value = "pageNum", defaultValue = "1")Integer pageNum,
            @ApiParam(value = "每页显示数量") @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize,
            @ApiParam(value = "护理项目名称") @RequestParam(value = "name", required = false)String name,
            @ApiParam(value = "状态：0-禁用，1-启用") @RequestParam(value = "status", required = false)Integer status
    ) {
        PageResponse<NursingProjectVo> nursingProjectPageInfo = nursingProjectService.getByPage(name, status, pageNum, pageSize);
        return ResponseResult.success(nursingProjectPageInfo);
    }

    //根据id查询护理项目
    @GetMapping("/{id}")
    @ApiOperation("根据护理项目id查询护理项目")
    public ResponseResult<NursingProjectVo> getById(@ApiParam(value = "护理项目id") @PathVariable("id") Long id) {
        NursingProjectVo nursingProject = nursingProjectService.getById(id);
        return ResponseResult.success(nursingProject);
    }
}